//
//  MCReceivedHBDetailTableViewCell.m
//  XDYL
//
//  Created by MC on 2018/3/20.
//  Copyright © 2018年 TLYL01. All rights reserved.
//

#import "MCReceivedHBDetailTableViewCell.h"
#import "MCDataTool.h"

@interface MCReceivedHBDetailTableViewCell ()

//1
@property (nonatomic,strong)UILabel * lab1;//左上
//2
@property (nonatomic,strong)UILabel * lab2;//左下


//3
@property (nonatomic,strong)UILabel * lab3;//右上
//4
@property (nonatomic,strong)UILabel * lab4;//右下


@end

@implementation MCReceivedHBDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

- (void)initView{
    
    self.backgroundColor=[UIColor whiteColor];
    
    
//    /*
//     * logo
//     */
//    UIImageView * arrow=[[UIImageView alloc]init];
//    [self addSubview:arrow];
//    arrow.image=[UIImage imageNamed:@"person-icon-more"];
//    arrow.userInteractionEnabled=NO;
//    [arrow mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.mas_right).offset(-10);
//        make.width.mas_equalTo(9);
//        make.height.mas_equalTo(16);
//        make.centerY.equalTo(self.mas_centerY);
//    }];
    
    /*
     * 下划线
     */
    UIView * line =[[UIView alloc]init];
    line.backgroundColor=RGB(213,213,213);
    [self  addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-28);
        make.left.equalTo(self.mas_left).offset(28);
        make.bottom.equalTo(self.mas_bottom).offset(-1);
        make.height.mas_equalTo(0.5);
        
    }];
    
    
    CGFloat W = (G_SCREENWIDTH-28*2)/2.0;
    
    UILabel * lab1=[self GetAdaptiveLable:CGRectMake(28, 0, W, 47) AndText:@"加载中" andFont:14 andTextColor:RGB(46,46,46) andTextAlignment:NSTextAlignmentLeft];
    [self addSubview:lab1];
    _lab1=lab1;
    
    
    
    //lab2
    UILabel * lab2=[self GetAdaptiveLable:CGRectMake(28, 30, W, 36) AndText:@"加载中" andFont:10 andTextColor:RGB(136,136,136) andTextAlignment:NSTextAlignmentLeft];
    [self addSubview:lab2];
    _lab2=lab2;
    
    
    
    //lab3
    UILabel * lab3=[self GetAdaptiveLable:CGRectMake(G_SCREENWIDTH/2.0, 0, W, 65) AndText:@"加载中" andFont:14 andTextColor:RGB(255,69,69) andTextAlignment:NSTextAlignmentRight];
    [self addSubview:lab3];
    _lab3=lab3;
    
    //lab4
    UILabel * lab4=[self GetAdaptiveLable:CGRectMake(G_SCREENWIDTH/2.0, 33, W, 32) AndText:@"加载中" andFont:10 andTextColor:RGB(136,136,136) andTextAlignment:NSTextAlignmentRight];
    [self addSubview:lab4];
    _lab4=lab4;
    
    
}


-(UILabel *)GetAdaptiveLable:(CGRect)rect AndText:(NSString *)contentStr andFont:(CGFloat)font  andTextColor:(UIColor *)textColor andTextAlignment:(NSTextAlignment)textAlignment;
{
    
    
    UILabel *contentLbl = [[UILabel alloc] initWithFrame:rect];
    contentLbl.text = contentStr;
    contentLbl.textAlignment = textAlignment;
    contentLbl.numberOfLines = 0;
    contentLbl.font = [UIFont systemFontOfSize:font];
    contentLbl.textColor=textColor;
    contentLbl.clipsToBounds=YES;
    
    return contentLbl;
}


+(CGFloat)computeHeight:(id)info{
    
    return 65;
}

-(void)setDataSource:(MCDetailListModel *)dataSource{
    
    _lab1.text=[NSString stringWithFormat:@"%@",dataSource.UserName];//@"刘德华";
    _lab2.text=[NSString stringWithFormat:@"%@",dataSource.GrabTime];//@"20170815 09:03:06";
    NSString * GrabMoney=[NSString stringWithFormat:@"%@",dataSource.GrabMoney];
    GrabMoney=GetTwoDigitRealSNum(GrabMoney);
    _lab3.text=[NSString stringWithFormat:@"%@元",GrabMoney];//@"195.65元";
    if ([[NSString stringWithFormat:@"%@",dataSource.Best] isEqualToString:@"1"]) {
        _lab4.text=@"手气最佳";
    }else{
        _lab4.text=@"";
    }
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end




















